//
//  NSObject+JSONUtil.m
//  AirPortMobile
//
//  Created by 瑜瑜 赵 on 12-12-24.
//  Copyright (c) 2012年 广州民航信息技术有限公司. All rights reserved.
//

#import "NSObject+JSONUtil.h"

@implementation NSObject (NSObject_JSONUtil)

- (NSString *)JSONRepresentation{
    NSString *jsonString = nil; 
    if ([NSJSONSerialization isValidJSONObject:self]){
        NSError *processError;
        NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self options:NSJSONWritingPrettyPrinted error:&processError];
        jsonString =[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];        
    }
    return jsonString;
}

@end
